TypeScript 61.9%
HTML 37.2%
SQL 0.7%
1import { NextResponse } from 'next/server';2import { connectorAction } from '@/lib/admin/actions';34export const runtime = 'nodejs';56/** JSON twin of the control-center buttons (for scripts/agents): POST /api/admin/connectors/:id/:action with the admin cookie. */7export async function POST(_req: Request, ctx: { params: Promise<{ id: string; action: string }> }) {8 const { id, action } = await ctx.params;9 const fd = new FormData();10 fd.set('id', id);11 fd.set('action', action);12 try {13 await connectorAction(fd);14 return NextResponse.json({ ok: true, id, action });15 } catch (err) {16 return NextResponse.json({ ok: false, error: err instanceof Error ? err.message : String(err) }, { status: 400 });17 }18}19